import time


# 利用求和公式的无迭代算法
def sumof(n):
    start = time.time()
    theSum = (n * (n + 1)) / 2
    end = time.time()
    return theSum, end - start


for i in range(5):
    s, t = sumof(100000)
    print(f'计算结果{s},花费{t:.7f}s')
